package ar.com.digitalbricks.core.behavior.mgr;

import java.math.BigDecimal;

import ar.com.digitalbricks.core.MenuItem;
import ar.com.digitalbricks.core.TipoMenuItem;
import ar.com.digitalbricks.core.behavior.Menu;
import ar.com.digitalbricks.core.dao.TipoMenuItemDAO;
import ar.com.digitalbricks.core.impl.MenuItemImpl;
import ar.com.digitalbricks.core.impl.TipoMenuItemImpl;

public class MenuMgr {
	private Menu menu;
	private TipoMenuItemDAO tipoMenuItemDAO;
	
	public void crearTipoMenuItem(String code, String description){
		TipoMenuItem tipoMenuItem = new TipoMenuItemImpl();
		tipoMenuItem.setCode(code);
		tipoMenuItem.setDescription(description);
		tipoMenuItem.save();
		this.getMenu().addTipoMenuItem(tipoMenuItem);
	}
	
	public void crearMenuItem(String code, String description, String precio, String tipoMenuItemCode){
		MenuItem menuItem = new MenuItemImpl();
		menuItem.setCode(code);
		menuItem.setDescription(description);
		menuItem.setPrecio(new BigDecimal(precio));
		menuItem.setTipoMenuItem(this.getTipoMenuItemDAO().loadByCode(tipoMenuItemCode));
		menuItem.save();
		this.getMenu().addMenuItem(menuItem);
	}

	public Menu getMenu() {
		return this.menu;
	}

	public void setMenu(Menu menu) {
		this.menu = menu;
	}

	public TipoMenuItemDAO getTipoMenuItemDAO() {
		return this.tipoMenuItemDAO;
	}

	public void setTipoMenuItemDAO(TipoMenuItemDAO tipoMenuItemDAO) {
		this.tipoMenuItemDAO = tipoMenuItemDAO;
	}

}
